<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<link rel="stylesheet" media="screen" type="text/css"
	href="styles/1CssMaster.css" />

<link rel="stylesheet" media="screen" type="text/css"
	href="styles/tableau.css" />

<link rel="stylesheet" media="screen" type="text/css"
	href="styles/facturation.css" />
<script type="text/javascript">
	// FonctionJavaScript qui permet de switcher entre le tableau de calcul et la la generation cf "onevent'

	function facturesGenerees() {
		document.getElementById('formulaireGeneration:tableCalcul').style.display = 'none';
		document.getElementById('formulaireGeneration:table1').style.display = 'block';

	}
</script>

<title>Facturation avant génération</title>

</head>
<!-- /////////////////////////////////////////////body/////////////////////////////////////////////////////////////////////////-->
<body>
	<div id="headerDroite">
			<h:form>
				<h:panelGrid columns="2">
					<h:outputText style="center:left" value="#{mbConnexion.leLogin}" />
					<h:commandButton value="Déconnexion"
						action="#{mbConnexion.deconnexion}" />
					<h:outputText style="center:left" />
					<h:outputText style="center:left" />
				</h:panelGrid>
			</h:form>
		</div>
		<div id="divTitre">
			<h1 id="nomLogiciel">Gepeto</h1>
			<img alt="" src="../../mairie/imagesGepeto/plumeSansFond.png"
				width="80px" height="80px" />

		</div>

	<div id="divMenuHaut">

		<ul id="ulMenuHaut">

			<li class="liMenuHaut"><a href="ficheEnfant.xhtml">Dossier
					Enfant</a></li>
			<li class="liMenuHaut"><a href="inscription.xhtml">Inscription</a></li>
			<li class="liMenuHaut"><a href="pointage.xhtml">Pointage</a></li>
			<li class="liMenuHaut"><a href="factConsultation.xhtml">Facturation</a></li>
			<li class="liMenuHaut"><a href="editions.xhtml">Editions</a></li>
			<li class="liMenuHaut"><a href="personnel.xhtml">Personnel</a></li>
		</ul>
	</div>
	<!--///////////////////////////////////menu gauche ///////////////////-->
	<div id="divSousMenuGauche">

		<ul id="ulSousMenuGauche">
			<li class="liSousMenuGauche"><a
				href="factGenerationAvGeneration.xhtml">Génération des Factures</a></li>
			<li class="liSousMenuGauche"><a href="factConsultation.xhtml">Consultation</a></li>
			<li class="liSousMenuGauche"><a href="factEnvoi.xhtml">Envoi
					automatique</a></li>
			<li class="liSousMenuGauche"><a href="factSuiviReglement.xhtml">Suivi
					des règlements</a></li>

			<li class="liSousMenuGauche"><a href="#">Clôture des
					périodes</a></li>
		</ul>
	</div>
	<div id="centre">

		<!-- 	///////////////////////////////////////////////critères/////////////////////////////////////////////  -->
		<div id="divRecherche">
			<h:form id="formulaireGeneration">

				<fieldset id="recherche">
					<legend>
						<b>Critères</b>
					</legend>

					<table>
						<tr>
							<td class="tdRech"><h:selectOneMenu id="selectPeriode"
									value="#{beanFactCalcul.idPeriode}">
									<f:selectItem itemValue="1" itemLabel="04/09/2012 - 26/10/2012" />
									<f:selectItem itemValue="2" itemLabel="08/11/2012 - 21/12/2012" />
									<f:selectItem itemValue="3" itemLabel="07/01/2013 - 01/03/2013" />
									<f:selectItem itemValue="4" itemLabel="18/03/2013 - 26/04/2013" />
									<f:selectItem itemValue="5" itemLabel="13/05/2013 - 04/07/2013" />
								</h:selectOneMenu></td>


							<td class="tdRech"><h:selectOneMenu id="selectEcole"
									value="#{beanFactCalcul.idEcole}">
									<f:selectItem itemValue="1" itemLabel="prim.Georges-Cogniot" />
									<f:selectItem itemValue="2" itemLabel="prim.Fernand-Léger" />
									<f:selectItem itemValue="3" itemLabel="prim.Jean-Jaurès" />
									<f:selectItem itemValue="4" itemLabel="prim.Guy-Môquet" />
									<f:selectItem itemValue="5" itemLabel="prim.Paul-Bert" />
									<f:selectItem itemValue="6"
										itemLabel="prim.Paul-Vaillant-Couturier" />
									<f:selectItem itemValue="7" itemLabel="prim.Paul-Langevin" />
									<f:selectItem itemValue="8" itemLabel="prim.Henri-Barbusse" />
									<f:selectItem itemValue="9" itemLabel="mat.Georges-Cogniot" />
									<f:selectItem itemValue="10" itemLabel="mat.Fernand-Léger" />
									<f:selectItem itemValue="11" itemLabel="mat.Jean-Jaurès" />
									<f:selectItem itemValue="12" itemLabel="mat.Guy-Môquet" />
									<f:selectItem itemValue="13" itemLabel="mat.Paul-Bert" />
									<f:selectItem itemValue="14" itemLabel="mat.Paul-Langevin" />
									<f:selectItem itemValue="15" itemLabel="mat.Henri-Barbusse" />
								</h:selectOneMenu></td>

							<th><h:commandButton value="Lancer le calcul des factures"
									type="submit"
									action="#{beanFactCalcul.chargementTableCalculFactures}">
									<f:ajax execute="selectPeriode selectEcole" render="tableCalul"
										onevent="document.getElementById('formulaireGeneration:tableCalcul').style.display='block'" />
								</h:commandButton></th>

						</tr>
					</table>

				</fieldset>


				<!-- 			/////////////////////////////////////////////////////////////Résultats calcul factures ///////////////////////////////////////////// -->

				<fieldset class="fieldSetResultat">
					<legend>
						<b>Résultat</b>
					</legend>

					<div class="datagrid">
						<h:dataTable id="tableCalul"
							value="#{beanFactCalcul.listeFactCalcul}" var="o"
							styleClass="order-table" headerClass="order-table-header"
							rowClasses="order-table-odd-row,order-table-even-row"
							rendered="#{not empty beanFactCalcul.listeFactCalcul}">

							<h:column>
								<f:facet name="header">Nom</f:facet>
    			#{o.nomEnf}
    		</h:column>

							<h:column>
								<f:facet name="header">prenom</f:facet>
    			#{o.prenomEnf}
    		</h:column>

							<h:column>
								<f:facet name="header">Rev.</f:facet>
    			#{o.revenu}
    		</h:column>


							<h:column>
								<f:facet name="header">Parts</f:facet>
    			#{o.nbPart}
    		</h:column>


							<h:column>
								<f:facet name="header">qf.</f:facet>
    			#{o.qf}
    		</h:column>

							<h:column>
								<f:facet name="header">JrMat.</f:facet>
    			#{o.nbjMatin}
    		</h:column>


							<h:column>
								<f:facet name="header">JrCant.</f:facet>
    			#{o.nbjCant}
    		</h:column>

							<h:column>
								<f:facet name="header">JrSoir</f:facet>
    			#{o.nbjSoir}
    		</h:column>


							<h:column>
								<f:facet name="header">Total</f:facet>
    			#{o.montant}
    		</h:column>

						</h:dataTable>
						<h:dataTable id="table1"
							value="#{beanFactCalcul.listeFacturesGenerees}" var="o"
							styleClass="order-table" headerClass="order-table-header"
							rowClasses="order-table-odd-row,order-table-even-row"
							rendered="#{not empty beanFactCalcul.listeFacturesGenerees}">
							
					<h:column>
								<f:facet name="header">Num. Facture</f:facet>
			    			#{o.idFacture}
			    		</h:column>
							<h:column>
								<f:facet name="header">Nom</f:facet>
			    			#{o.nomEnf}
			    		</h:column>

							<h:column>
								<f:facet name="header">prenom</f:facet>
			    			#{o.prenomEnf}
			    		</h:column>
							<h:column>
								<f:facet name="header">Date Facture</f:facet>
			    			#{o.dateFacture}
			    		</h:column>

							<h:column>
								<f:facet name="header">Montant Global</f:facet>
			    			#{o.montantGlobal}€
			    		</h:column>

						</h:dataTable>
					</div>
				</fieldset>
				<!-- 							////////////////////////////////////////////////////////table factures generees///////////////////////////////////////////////				 -->
<!-- 				<div id="divGenerer"> -->
					<fieldset id="fieldSetGenerer">
						<legend>
							<b>Génération des facture</b>
						</legend>

						<table id="tableGenerer">
							<tr>
								<td><select name="dateGenenration">
										<option>04/04/2013</option>
								</select></td>
								<th><h:commandButton value="Générer les factures"
										type="submit"
										action="#{beanFactCalcul.chargementTableFacturesGenerees}">
										<f:ajax execute="selectPeriode selectEcole tableCalul"
											render="table1" onevent="facturesGenerees()" />
									</h:commandButton></th>
							</tr>
						</table>
					</fieldset>
<!-- 				</div> -->
			</h:form>
		</div>

	</div>
</body>
</html>